import os
from django.utils.translation import gettext_lazy as _
from pathlib    import  Path
BASE_DIR = Path(__file__).resolve().parent.parent
print('根目录，',1,BASE_DIR)
import sys
from pathlib import Path
 
print(2,BASE_DIR)

# 添加应用目录到Python路径
sys.path.insert(0, str(BASE_DIR / "app"))  # 注意这里是app目录
print(3,sys.path)
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'walmart',
        'USER': 'root',
        'PASSWORD': 'Zb_200407',
        'HOST': 'gz-cdb-d4j7h16x.sql.tencentcdb.com',
        'PORT': '22333',
        'OPTIONS': {
            'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
            'charset': 'utf8mb4',
            'connect_timeout': 10,
        },
        'CONN_MAX_AGE': 60,
    }
}
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'ebay',  # eBay业务管理系统
    'app',  # 确保存在
]
AUTH_USER_MODEL = 'auth.User'  # 恢复使用默认用户模型

FILE_CHARSET = 'utf-8'
DEFAULT_CHARSET = 'utf-8'
DEBUG = True
CSRF_TRUSTED_ORIGINS = ['http://127.0.0.1:8888', 'http://localhost:8888']

ALLOWED_HOSTS = ['localhost', '127.0.0.1']


TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        'APP_DIRS': True,  # 确保这个设置为 True
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

MIDDLEWARE = [
    # 'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    # 'django.middleware.locale.LocaleMiddleware',
    'django.middleware.common.CommonMiddleware',
    # 'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'


ROOT_URLCONF = 'walmartca.urls'

SECRET_KEY = 'your_generated_secret_key_here'

LANGUAGE_CODE = 'zh-hans'
TIME_ZONE = 'Asia/Shanghai'
USE_I18N = True
USE_L10N = True
USE_TZ = False
  

LANGUAGES = [
    ('zh-hans', _('Chinese')),
    ('en', _('English')),
]

LOCALE_PATHS = [
    os.path.join(BASE_DIR, 'locale'),
]
 
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

print(MEDIA_ROOT) 

# 静态文件配置改为：
STATIC_URL = '/static/'
STATICFILES_DIRS = [
    BASE_DIR / 'static',  # 指向您实际的static目录
]

STATIC_ROOT = BASE_DIR / 'staticfiles'  # 改为不冲突的目录名

print('STATIC_ROOT:', STATIC_ROOT)
print('STATICFILES_DIRS:', STATICFILES_DIRS)
 
SESSION_COOKIE_AGE =3600 #

# Amazon API Settings
AMAZON_CLIENT_ID = 'your_client_id_here'  # 替换为你的应用ID
AMAZON_CLIENT_SECRET = 'your_client_secret_here'  # 替换为你的应用密钥
AMAZON_REDIRECT_URI = 'https://jgsroar.cn/admin/app/amazonstore/callback'  # 替换为你的回调URL
EBAY_REDIRECT_URI = AMAZON_REDIRECT_URI 
# eBay API Settings (请配置您的eBay API凭证)
# sandbox=True
# EBAY_APP_ID = '-roarerp-SBX-b47259a7e-c9c9b466'
# EBAY_CERT_ID = 'SBX-47259a7e4c1f-06a7-4b5b-8f9a-5bc9'
# EBAY_CLIENT_ID = '-roarerp-SBX-b47259a7e-c9c9b466'
# EBAY_CLIENT_SECRET = 'SBX-47259a7e4c1f-06a7-4b5b-8f9a-5bc9'
# EBAY_DEV_ID = '49a17999-a37a-4a74-a084-8801c12113ba'


EBAY_SANDBOX=False
EBAY_APP_ID = '-roarerp-PRD-147483244-27f73464'
EBAY_CERT_ID = 'PRD-4748324408d6-de86-4823-92a4-7226'
EBAY_CLIENT_ID = EBAY_APP_ID
EBAY_CLIENT_SECRET = EBAY_CERT_ID
EBAY_DEV_ID = '49a17999-a37a-4a74-a084-8801c12113ba'
 

EBAY_AUTH_TOKEN = ''